package com.atmilan.quartz.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.atmilan.quartz.service.IAsyncService;
import com.atmilan.quartz.service.ISystemConfigService;

import lombok.Data;


/**
* @author Mr.Zhang
* @Description AsyncServiceImpl 同步到云服务
* @since 2020-05-06
*/
@Service
@Data
public class AsyncServiceImpl implements IAsyncService {
    // 当前使用的云服务Url
    private String leftBase = null;
    @Autowired
    private ISystemConfigService systemConfigService;
    
    @Override
    public String getCurrentBaseUrl() {
        if(leftBase != null){
            return leftBase;
        }
        String uploadType = systemConfigService.getValueByKeyException("uploadType");
        //获取配置信息
        int type = Integer.parseInt(uploadType);
        String pre = "local";
        switch (type){
            case 2:
                pre = "qn";
                break;
            case 3:
                pre = "al";
                break;
            case 4:
                pre = "tx";
                break;
            default:
                break;
        }

        return systemConfigService.getValueByKey(pre+"UploadUrl");
    }
    
}

